﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>基础资料修改流程</title>
    <link rel="stylesheet" type="text/css" href="../../Portal/icons/font-icons.min.css" />
    <script type="text/javascript" src="../../Portal/js/sortjs/Sortable.min.js"></script>
    <!--- 引入代码. -->
    <script src="../../Scripts/jquery/jquery.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../Comm/Gener.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Portal/js/vue/vue.js"></script>
    <script src="../../Scripts/layui/LayuiDialog.js"></script>
    <script src="../../Scripts/layui/layui/layui.js"></script>
    <link href="../../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
    <style>
        .method {
            width: 100%;
        }

            .method .row {
                display: flex;
                justify-content: flex-start;
                flex: 0.2;
                height: 40px;
                line-height: 40px;
                background-color: #FAFAFA;
            }

                .method .row .item {
                    box-sizing: border-box;
                    flex-shrink: 0;
                    text-align: center;
                    border-right: 1px solid #eee;
                    border-bottom: 1px solid #eee;
                }

        .item-name {
            width: 35%;
            text-overmethod: ellipsis;
            white-space: nowrap;
            cursor: pointer;
            padding-left: 5px;
            overflow: hidden
        }

        .item-num {
            width: 8%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .item-other {
            width: 13%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .item-docs {
            width: 30%;
            display: flex;
            align-items: center;
            justify-content: center;
        }


        .item-index {
            background-color: #FAFAFA;
            padding-right: 15px;
            color: #999999
        }

        .method .row .folder-item {
            box-sizing: border-box;
            width: 74%;
            padding-left: 20px;
            cursor: pointer;
        }

        .wrapper .row {
            background-color: #fff;
        }

        #s-main {
            transition: all ease .4s;
            margin-top: 40px;
        }

        .fixed {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
        }

        [v-cloak] {
            display: none;
        }

        .layui-input-block > .layui-form-switch {
            margin-top: 0 !important;
        }
    </style>
    <style id="theme-data">
    </style>
</head>
<body>
    <div class="method" id="method">
        <div class="layui-full" style="margin-top:10px;">
            <div class="layui-row">
                <div class="layui-col-sm6">
                    <div class="layui-inline">
                        <input type="text" id="TB_Key" name="TB_Key" class="layui-input layui-col-sm4" placeholder="关键字" />
                    </div>
                    <button onclick="Search()" class="layui-btn layui-btn-sm"> 查询</button>
                    <button onclick="StartIt()" class="layui-btn layui-btn-sm" id="StartIt">新建</button>

                </div>
                <div class="layui-col-sm6" style="text-align:right">
                    <button onclick="SearchAdv()" class="layui-btn layui-btn-sm">高级查询</button>
                </div>

            </div>

        </div>
        <div class="row" style="margin-top:10px;">
            <div class="item item-index">#</div>
            <div class="item item-other">状态</div>
            <div class="item item-name"><i class="icon-app"></i> 标题</div>
            <div class="item item-other">发起人</div>
            <div class="item item-other">发起日期</div>
            <div class="item item-other">停留节点</div>
            <div class="item item-other">处理人</div>
        </div>

        <div class="row" v-for="(item,idx) in gwfs" :key="idx" :data-id="item.WorkID">
            <div class="item item-index" style="text-align: right;">{{idx + 1}}</div>
            <div class="item item-other"><i :class="item.Icon"></i> {{item.IconTitle}}</div>

            <div class="item item-name"
                 style="text-align: left" :data-mypk="item.WorkID" :data-name="item.Title"
                 :data-idx="idx" @click.stop="OpenMyView(item.FK_Flow,item.WorkID)">
                <span> <font color="blue">{{item.Title}}</font></span>
            </div>
            <div class="item item-other">{{item.StarterName}}</div>
            <div class="item item-other">{{item.RDT}}</div>
            <div class="item item-other">{{item.NodeName}} </div>
            <div class="item item-other">{{item.TodoEmps}} </div>

        </div>

    </div>
    <script type="text/javascript">
        $(function () {

            //var handler = new HttpHandler("BP.CCBill.WF_CCBill_OptOneFlow");
            //handler.AddUrlData();
            //var data = handler.DoMethodReturnString("FlowEtc_Init");
            //if (data.indexOf('err@') == 0) {
            //    alert(data);
            //    return;
            //}
        });

        new Vue({
            el: '#method',

            data: {
                gwfs: []
            },
            methods: {
                OpenMyView: function (flowNo, workid) {

                    var handler = new HttpHandler("BP.WF.HttpHandler.WF_MyView");
                    handler.AddPara("WorkID", workid);
                    handler.AddPara("FK_Flow", flowNo);
                    var data = handler.DoMethodReturnString("MyView_Init");
                    if (data.indexOf('err@') == 0) {
                        alert(data);
                        //  $("#Msg").html("<br>" + data);
                        return;
                    }
                    if (data.indexOf('url@') == 0) {

                        data = data.replace('url@', ''); //如果返回url，就直接转向.
                        data = data.replace('?DoType=HttpHandler', '?');
                        data = data.replace('&DoType=HttpHandler', '');
                        data = data.replace('&DoMethod=MyView_Init', '');
                        data = data.replace('&HttpHandlerName=BP.WF.HttpHandler.WF_MyCC', '');
                        data = data.replace('?&', '?');


                        //var url = "../" + data;
                        var url = "../../" + data;

                        //如果返回url，就直接转向.
                        SetHref(url); //
                        // LayuiPopRight(url, null, 0, 900, false);
                        return;
                    }
                }, Test: function (flowNo, workid) {

                }
            },
            mounted: function () {

                // fix firefox bug
                document.body.ondrop = function (event) {
                    event.preventDefault();
                    event.stopPropagation();
                }



                var frmID = GetQueryString("FrmID");
                var workID = GetQueryString("WorkID");
                var flowNo = GetQueryString("FlowNo");

                var ens = new Entities("BP.WF.GenerWorkFlows");
                ens.Retrieve("PWorkID", workID, "PFlowNo", frmID, "FK_Flow", flowNo, "RDT");
                var ens = ens.TurnToArry();

                var ens = $.grep(ens, function (en) {
                    return en.WFState > 1;
                })

                for (var i = 0; i < ens.length; i++) {

                    var gwf = ens[i];
                    //  if (gwf.WFState <= 1) continue; //草稿与空白的.
                    if (gwf.WFState === 0) { gwf.Icon = "icon-clock"; gwf.IconTitle = "空白"; }//运行中的.
                    if (gwf.WFState === 1) { gwf.Icon = "icon-clock"; gwf.IconTitle = "草稿"; }//运行中的.
                    if (gwf.WFState === 2) { gwf.Icon = "icon-clock"; gwf.IconTitle = "运行中"; }//运行中的.
                    if (gwf.WFState === 3) { gwf.Icon = "icon-check"; gwf.IconTitle = "已完成"; }//已完成的.
                    if (gwf.WFState === 5) { gwf.Icon = "icon-action-undo"; gwf.IconTitle = "退回"; } //退回的.

                }
                this.gwfs = ens;
            }
        })

        function StartIt() {
            var loading = layer.load(0, {
                shade: false,
               
            });
            var handler = new HttpHandler("BP.CCBill.WF_CCBill");
            handler.AddPara("MethodNo", GetQueryString("MethodNo"));
            handler.AddPara("WorkID", GetQueryString("WorkID"));
            handler.AddPara("FrmID", GetQueryString("FrmID"));

            var data = handler.DoMethodReturnString("MyDict_DoFlowEtc_StartFlow");
            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            } else {
                layer.close(loading);
                SetHref("../" + data);
            }
        }

        //查询
        function Search() {
            //对this.gwfs 的数据 的Title 进行过滤匹配,从新绑定表格.
        }

        //高级查询.
        function SearchAdv() {

            var url = "";
            url = "../../../App/OneFlow/RptSearch.htm?FK_Flow=" + GetQueryString("FlowNo");
            url += "&WorkID=" + GetQueryString("WorkID");
            url += "&MethodNo=" + GetQueryString("MethodNo");

            SetHref(url);
        }
    </script>
    <script>
        $(function () {
            var theme = DealText(localStorage.getItem("themeColorInfo"));
            theme = JSON.parse(theme);
            var styleScope = document.getElementById("theme-data");
             
            var html = "\n .layui-btn{\n background-color:" + theme.selectedMenu + ";\n}\n .layui-laypage .layui-laypage-curr .layui-laypage-em{\n background-color:" + theme.selectedMenu + ";\n}";
            html += "\n .layui-laypage input:focus,.layui-laypage select:focus{\n border-color:" + theme.selectedMenu + " !important\n}";
            html += "\n .layui-form-select dl dd.layui-this{\n background-color:" + theme.selectedMenu + " !important;\n}";

            styleScope.innerHTML = DealText(html);

        })
    </script>
</body>
</html>